package com.xuecheng.api.comment.model;

import com.xuecheng.common.domain.page.PageRequestParams;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * Created on 2021/03/28/10:03 周日
 * <p>
 *  课程基本信息查询条件封装 QO （query object）
 * </p>
 * @description 根据课程名称、审核状态条件进行数据查询
 *
 * @author Lantin
 */
@Data
@AllArgsConstructor
@ApiModel("课程发布评论 查询 QO对象")
public class QuerryCommentModel {


    @ApiModelProperty("评价级别[1好评 0中评 -1差评]")
    private Integer level;

    @ApiModelProperty("回复状态 Y/N")
    private String replyStatus;

    @ApiModelProperty("评论对象,课程发布id")
    private Integer targetId;

    @ApiModelProperty("评论对象[课程名称]")
    private String targetName;

    @ApiModelProperty("评价级别[1好评 0中评 -1差评]")
    private Long companyId;

    public static final Integer DEFAULT_PAGE_SIZE = 20;
    public static final Long DEFAULT_PAGE_NUM = Long.valueOf(1);

    /**
     * 当前页
     */
    private Long pageNo = DEFAULT_PAGE_NUM;
    /**
     * 每页条数
     */
    private Integer pageSize = DEFAULT_PAGE_SIZE;
    /**
     * 是否排序
     */
    private String order;
    /**
     * 排序的字段
     */
    private String sortBy;


    public QuerryCommentModel () {

    }

    private QuerryCommentModel(Long pageNo, Integer limit){
        this.pageNo = pageNo;
        this.pageSize = limit;
    }

    public static QuerryCommentModel of(Integer pageNo, Integer pageSize){
        Long startRow = Long.valueOf((pageNo - 1) * pageSize);
        return new QuerryCommentModel(startRow, pageSize);
    }

}
